//#############################################################################
//#############################################################################
//This source file was written by Mert Dogar. If you have some questions about 
//the source code, please do not hesitate to ask me.
//The code is under GPL.
//Email: mertdogar@gmail.com , http://code.google.com/p/electron-cds
//#############################################################################
//#############################################################################

#include "main.h"
#include "./tinyxml/tinyxml.h"

void build_simple_doc( )
{
	// same as write_simple_doc1 but add each node
	// as early as possible into the tree.

	TiXmlDocument doc;
	TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "", "" );
	doc.LinkEndChild( decl );
	
	TiXmlElement * element = new TiXmlElement( "app" );
	doc.LinkEndChild( element );
	
	TiXmlElement *celement = new TiXmlElement( "sheet");
	celement->SetAttribute("width",2000);
	celement->SetAttribute("height",2000);
	celement->SetAttribute("x",0);
	celement->SetAttribute("y",0);
	celement->SetAttribute("count",3);
	element->LinkEndChild(celement);
	
	TiXmlElement *celement2 = new TiXmlElement( "normal_color");
	celement2->SetAttribute("red",0);
	celement2->SetAttribute("green",0);
	celement2->SetAttribute("blue",0);
	element->LinkEndChild(celement2);

	TiXmlElement *celement3 = new TiXmlElement( "selected_color");
	celement3->SetAttribute("red",1);
	celement3->SetAttribute("green",1);
	celement3->SetAttribute("blue",0);
	element->LinkEndChild(celement3);	
	
	
	
	TiXmlText * text = new TiXmlText( "World" );
	element->LinkEndChild( text );
	
	doc.SaveFile( "madeByHand2.xml" );

}



void read_settings(std::string filename)
{	
	
TiXmlDocument doc( filename.c_str() );
doc.LoadFile();
build_simple_doc( );
}
// load the named file and dump its structure to STDOUT
